package service

import (
	"znet/zmodule/zservice"
	"demo/userservice/conf"
	"znet/zmodule"
	"znet/leaf/module"
)

var (
	skeleton = zmodule.NewSkeleton()
	ChanRPC  = skeleton.ChanRPCServer
	Module	 = new(Service)
)

type Service struct {
	*module.Skeleton
	*zservice.ServiceModule
}
func (this *Service) OnInit() {
	this.Skeleton 		= skeleton
	this.ServiceModule 	= &zservice.ServiceModule{
		Addr:conf.Server.Service.Attr,
	}
	this.ServiceModule.Init()
	this.ServiceModule.AddService(conf.Server.Service.Name,&ServiceImpl{})
	// 开始service
	this.Start()
}
func (this *Service) OnDestroy() {
	this.ServiceModule.Stop()
}